home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / MacTCP.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  20.8 KB  |  806 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MacTCP.p
  3.  
  4.      Contains:    TCP Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacTCP 2.0.6
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1989-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT MacTCP;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __MACTCP__}
  28. {$SETC __MACTCP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC MacTCPIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MIXEDMODE__}
  38. {$I MixedMode.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __APPLETALK__}
  41. {$I AppleTalk.p}
  42. {$ENDC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49. {
  50. Developer Notes:
  51.         0. This MacTCP header replaces what used to be defined in the following header files
  52.             MacTCPCommonTypes.h
  53.             GetMyIPAddr.h
  54.             MiscIPPB.h
  55.             TCPPB.h
  56.             UDPPB.h 
  57.             
  58.             When the various control calls are made to the ip driver, you must set up a 
  59.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  60.             Otherwise, the 68K driver code, will not correctly call your routine.
  61.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  62.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  63.             the ioCompletion parameter.
  64.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  65.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  66.             to pass in the ioCompletion field of the parameter block.
  67.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  68.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  69.             of the parameter block
  70.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  71.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  72.             universal procptr to pass in the ioCompletion field of the paramter
  73.             block.
  74.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  75.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  76.             of the parameter block
  77.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  78.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  79.             universal procptr to pass in the ioCompletion field of the paramter
  80.             block.
  81.         7. For all calls implementing a notifyProc or ioCompletion routine
  82.             which was set up using a NewTCPRoutineProc call, do not call
  83.             DisposeRoutineSDescriptor on the universal procptr until
  84.             after the completion or notify proc has completed.
  85. }
  86.  
  87. { MacTCP return Codes in the range -23000 through -23049 }
  88.  
  89. CONST
  90.     inProgress                    = 1;                            {  I/O in progress  }
  91.     ipBadLapErr                    = -23000;                        {  bad network configuration  }
  92.     ipBadCnfgErr                = -23001;                        {  bad IP configuration error  }
  93.     ipNoCnfgErr                    = -23002;                        {  missing IP or LAP configuration error  }
  94.     ipLoadErr                    = -23003;                        {  error in MacTCP load  }
  95.     ipBadAddr                    = -23004;                        {  error in getting address  }
  96.     connectionClosing            = -23005;                        {  connection is closing  }
  97.     invalidLength                = -23006;
  98.     connectionExists            = -23007;                        {  request conflicts with existing connection  }
  99.     connectionDoesntExist        = -23008;                        {  connection does not exist  }
  100.     insufficientResources        = -23009;                        {  insufficient resources to perform request  }
  101.     invalidStreamPtr            = -23010;
  102.     streamAlreadyOpen            = -23011;
  103.     connectionTerminated        = -23012;
  104.     invalidBufPtr                = -23013;
  105.     invalidRDS                    = -23014;
  106.     invalidWDS                    = -23014;
  107.     openFailed                    = -23015;
  108.     commandTimeout                = -23016;
  109.     duplicateSocket                = -23017;
  110.  
  111. { Error codes from internal IP functions }
  112.     ipDontFragErr                = -23032;                        {  Packet too large to send w/o fragmenting  }
  113.     ipDestDeadErr                = -23033;                        {  destination not responding  }
  114.     icmpEchoTimeoutErr            = -23035;                        {  ICMP echo timed-out  }
  115.     ipNoFragMemErr                = -23036;                        {  no memory to send fragmented pkt  }
  116.     ipRouteErr                    = -23037;                        {  can't route packet off-net  }
  117.     nameSyntaxErr                = -23041;
  118.     cacheFault                    = -23042;
  119.     noResultProc                = -23043;
  120.     noNameServer                = -23044;
  121.     authNameErr                    = -23045;
  122.     noAnsErr                    = -23046;
  123.     dnrErr                        = -23047;
  124.     outOfMemory                    = -23048;
  125.  
  126.  
  127.     BYTES_16WORD                = 2;                            {  bytes per = 16, bit ip word  }
  128.     BYTES_32WORD                = 4;                            {  bytes per = 32, bit ip word  }
  129.     BYTES_64WORD                = 8;                            {  bytes per = 64, bit ip word  }
  130.  
  131. { 8-bit quantity }
  132.  
  133. TYPE
  134.     b_8                                    = UInt8;
  135. { 16-bit quantity }
  136.     b_16                                = UInt16;
  137. { 32-bit quantity }
  138.     b_32                                = UInt32;
  139. { IP address is 32-bits }
  140.     ip_addr                                = b_32;
  141.     ip_addrbytesPtr = ^ip_addrbytes;
  142.     ip_addrbytes = RECORD
  143.         CASE INTEGER OF
  144.         0: (
  145.             addr:                b_32;
  146.             );
  147.         1: (
  148.             byte:                PACKED ARRAY [0..3] OF UInt8;
  149.             );
  150.     END;
  151.  
  152.     wdsEntryPtr = ^wdsEntry;
  153.     wdsEntry = RECORD
  154.         length:                    INTEGER;                                {  length of buffer  }
  155.         ptr:                    Ptr;                                    {  pointer to buffer  }
  156.     END;
  157.  
  158.     rdsEntryPtr = ^rdsEntry;
  159.     rdsEntry = RECORD
  160.         length:                    INTEGER;                                {  length of buffer  }
  161.         ptr:                    Ptr;                                    {  pointer to buffer  }
  162.     END;
  163.  
  164.     BufferPtr                            = LONGINT;
  165.     StreamPtr                            = LONGINT;
  166.  
  167. CONST
  168.     netUnreach                    = 0;
  169.     hostUnreach                    = 1;
  170.     protocolUnreach                = 2;
  171.     portUnreach                    = 3;
  172.     fragReqd                    = 4;
  173.     sourceRouteFailed            = 5;
  174.     timeExceeded                = 6;
  175.     parmProblem                    = 7;
  176.     missingOption                = 8;
  177.     lastICMPMsgType                = 32767;
  178.  
  179.  
  180. TYPE
  181.     ICMPMsgType                            = INTEGER;
  182.     ip_port                                = b_16;
  183.     ICMPReportPtr = ^ICMPReport;
  184.     ICMPReport = RECORD
  185.         streamPtr:                StreamPtr;
  186.         localHost:                ip_addr;
  187.         localPort:                ip_port;
  188.         remoteHost:                ip_addr;
  189.         remotePort:                ip_port;
  190.         reportType:                INTEGER;
  191.         optionalAddlInfo:        INTEGER;
  192.         optionalAddlInfoPtr:    LONGINT;
  193.     END;
  194.  
  195. { csCode to get our IP address }
  196.  
  197. CONST
  198.     ipctlGetAddr                = 15;
  199.  
  200.  
  201. TYPE
  202.     GetAddrParamBlockPtr = ^GetAddrParamBlock;
  203.     GetIPIOCompletionProcPtr = ProcPtr;  { PROCEDURE GetIPIOCompletion(VAR iopb: GetAddrParamBlock); C; }
  204.  
  205.     GetIPIOCompletionUPP = UniversalProcPtr;
  206.     GetAddrParamBlock = RECORD
  207.         qLink:                    QElemPtr;
  208.         qType:                    INTEGER;
  209.         ioTrap:                    INTEGER;
  210.         ioCmdAddr:                Ptr;
  211.         ioCompletion:            GetIPIOCompletionUPP;
  212.         ioResult:                OSErr;
  213.         ioNamePtr:                StringPtr;
  214.         ioVRefNum:                INTEGER;
  215.         ioCRefNum:                INTEGER;
  216.         csCode:                    INTEGER;
  217.         ourAddress:                ip_addr;                                {  our IP address  }
  218.         ourNetMask:                LONGINT;                                {  our IP net mask  }
  219.     END;
  220.  
  221. { control codes }
  222.  
  223. CONST
  224.     ipctlEchoICMP                = 17;                            {  send icmp echo  }
  225.     ipctlLAPStats                = 19;                            {  get lap stats  }
  226.  
  227.  
  228.  
  229. TYPE
  230.     ICMPParamBlockPtr = ^ICMPParamBlock;
  231.     IPIOCompletionProcPtr = ProcPtr;  { PROCEDURE IPIOCompletion(VAR iopb: ICMPParamBlock); C; }
  232.  
  233.     IPIOCompletionUPP = UniversalProcPtr;
  234.     ICMPParamBlock = RECORD
  235.         qLink:                    QElemPtr;
  236.         qType:                    INTEGER;
  237.         ioTrap:                    INTEGER;
  238.         ioCmdAddr:                Ptr;
  239.         ioCompletion:            IPIOCompletionUPP;
  240.         ioResult:                OSErr;
  241.         ioNamePtr:                StringPtr;
  242.         ioVRefNum:                INTEGER;
  243.         ioCRefNum:                INTEGER;
  244.         csCode:                    INTEGER;
  245.         params:                    ARRAY [0..10] OF INTEGER;
  246.         echoRequestOut:            LONGINT;                                {  time in ticks of when the echo request went out  }
  247.         echoReplyIn:            LONGINT;                                {  time in ticks of when the reply was received  }
  248.         echoedData:                rdsEntry;                                {  data received in responce  }
  249.         options:                Ptr;
  250.         userDataPtr:            LONGINT;
  251.     END;
  252.  
  253.     ICMPEchoNotifyProcPtr = ProcPtr;  { PROCEDURE ICMPEchoNotify(VAR iopb: ICMPParamBlock); C; }
  254.  
  255.     ICMPEchoNotifyUPP = UniversalProcPtr;
  256.     LAPStatsPtr = ^LAPStats;
  257.     IPParamBlockPtr = ^IPParamBlock;
  258.     IPParamBlock = RECORD
  259.         qLink:                    QElemPtr;
  260.         qType:                    INTEGER;
  261.         ioTrap:                    INTEGER;
  262.         ioCmdAddr:                Ptr;
  263.         ioCompletion:            IPIOCompletionUPP;
  264.         ioResult:                OSErr;
  265.         ioNamePtr:                StringPtr;
  266.         ioVRefNum:                INTEGER;
  267.         ioCRefNum:                INTEGER;
  268.         csCode:                    INTEGER;
  269.         CASE INTEGER OF
  270.         0: (
  271.             dest:                ip_addr;                                {  echo to IP address  }
  272.             data:                wdsEntry;
  273.             timeout:            INTEGER;
  274.             options:            Ptr;
  275.             optLength:            INTEGER;
  276.             icmpCompletion:        ICMPEchoNotifyUPP;
  277.             userDataPtr:        LONGINT;
  278.            );
  279.         1: (
  280.             lapStatsPtr:        LAPStatsPtr;
  281.            );
  282.     END;
  283.  
  284.  
  285.     nbp_entryPtr = ^nbp_entry;
  286.     nbp_entry = RECORD
  287.         ip_address:                ip_addr;                                {  IP address  }
  288.         at_address:                AddrBlock;                                {  matching AppleTalk address  }
  289.         gateway:                BOOLEAN;                                {  TRUE if entry for a gateway  }
  290.         valid:                    BOOLEAN;                                {  TRUE if LAP address is valid  }
  291.         probing:                BOOLEAN;                                {  TRUE if NBP lookup pending  }
  292.         afiller:                SInt8;                                    {  Filler for proper byte alignment      }
  293.         age:                    LONGINT;                                {  ticks since cache entry verified  }
  294.         access:                    LONGINT;                                {  ticks since last access  }
  295.         filler:                    ARRAY [0..115] OF SInt8;                {  for internal use only !!!  }
  296.     END;
  297.  
  298.     Enet_addrPtr = ^Enet_addr;
  299.     Enet_addr = RECORD
  300.         en_hi:                    b_16;
  301.         en_lo:                    b_32;
  302.     END;
  303.  
  304.     arp_entryPtr = ^arp_entry;
  305.     arp_entry = RECORD
  306.         age:                    INTEGER;                                {  cache aging field  }
  307.         protocol:                b_16;                                    {  Protocol type  }
  308.         ip_address:                ip_addr;                                {  IP address  }
  309.         en_address:                Enet_addr;                                {  matching Ethernet address  }
  310.     END;
  311.  
  312.     LAPStatsAddrXlationPtr = ^LAPStatsAddrXlation;
  313.     LAPStatsAddrXlation = RECORD
  314.         CASE INTEGER OF
  315.         0: (
  316.             arp_table:            arp_entryPtr;
  317.             );
  318.         1: (
  319.             nbp_table:            nbp_entryPtr;
  320.             );
  321.     END;
  322.  
  323.     LAPStats = RECORD
  324.         ifType:                    INTEGER;
  325.         ifString:                CStringPtr;
  326.         ifMaxMTU:                INTEGER;
  327.         ifSpeed:                LONGINT;
  328.         ifPhyAddrLength:        INTEGER;
  329.         ifPhysicalAddress:        CStringPtr;
  330.         AddrXlation:            LAPStatsAddrXlation;
  331.         slotNumber:                INTEGER;
  332.     END;
  333.  
  334. { number of ARP table entries }
  335.  
  336. CONST
  337.     ARP_TABLE_SIZE                = 20;
  338.  
  339.     NBP_TABLE_SIZE                = 20;                            {  number of NBP table entries  }
  340.     NBP_MAX_NAME_SIZE            = 28;
  341.  
  342.  
  343.  
  344. { Command codes }
  345.     TCPCreate                    = 30;
  346.     TCPPassiveOpen                = 31;
  347.     TCPActiveOpen                = 32;
  348.     TCPSend                        = 34;
  349.     TCPNoCopyRcv                = 35;
  350.     TCPRcvBfrReturn                = 36;
  351.     TCPRcv                        = 37;
  352.     TCPClose                    = 38;
  353.     TCPAbort                    = 39;
  354.     TCPStatus                    = 40;
  355.     TCPExtendedStat                = 41;
  356.     TCPRelease                    = 42;
  357.     TCPGlobalInfo                = 43;
  358.     TCPCtlMax                    = 49;
  359.  
  360.     TCPClosing                    = 1;
  361.     TCPULPTimeout                = 2;
  362.     TCPTerminate                = 3;
  363.     TCPDataArrival                = 4;
  364.     TCPUrgent                    = 5;
  365.     TCPICMPReceived                = 6;
  366.     lastEvent                    = 32767;
  367.  
  368.  
  369. TYPE
  370.     TCPEventCode                        = INTEGER;
  371.  
  372. CONST
  373.     TCPRemoteAbort                = 2;
  374.     TCPNetworkFailure            = 3;
  375.     TCPSecPrecMismatch            = 4;
  376.     TCPULPTimeoutTerminate        = 5;
  377.     TCPULPAbort                    = 6;
  378.     TCPULPClose                    = 7;
  379.     TCPServiceError                = 8;
  380.     lastReason                    = 32767;
  381.  
  382.  
  383. TYPE
  384.     TCPTerminationReason                = INTEGER;
  385.     TCPNotifyProcPtr = ProcPtr;  { PROCEDURE TCPNotify(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport); }
  386.  
  387.     TCPNotifyUPP = UniversalProcPtr;
  388.     tcp_port                            = INTEGER;
  389. { ValidityFlags }
  390.  
  391. CONST
  392.     timeoutValue                = $80;
  393.     timeoutAction                = $40;
  394.     typeOfService                = $20;
  395.     precedence                    = $10;
  396.  
  397. { TOSFlags }
  398.     lowDelay                    = $01;
  399.     throughPut                    = $02;
  400.     reliability                    = $04;
  401.  
  402.  
  403. TYPE
  404.     TCPCreatePBPtr = ^TCPCreatePB;
  405.     TCPCreatePB = RECORD
  406.         rcvBuff:                Ptr;
  407.         rcvBuffLen:                LONGINT;
  408.         notifyProc:                TCPNotifyUPP;
  409.         userDataPtr:            Ptr;
  410.     END;
  411.  
  412.     TCPOpenPBPtr = ^TCPOpenPB;
  413.     TCPOpenPB = RECORD
  414.         ulpTimeoutValue:        SInt8;
  415.         ulpTimeoutAction:        SInt8;
  416.         validityFlags:            SInt8;
  417.         commandTimeoutValue:    SInt8;
  418.         remoteHost:                ip_addr;
  419.         remotePort:                tcp_port;
  420.         localHost:                ip_addr;
  421.         localPort:                tcp_port;
  422.         tosFlags:                SInt8;
  423.         precedence:                SInt8;
  424.         dontFrag:                BOOLEAN;
  425.         timeToLive:                SInt8;
  426.         security:                SInt8;
  427.         optionCnt:                SInt8;
  428.         options:                ARRAY [0..39] OF SInt8;
  429.         userDataPtr:            Ptr;
  430.     END;
  431.  
  432.  
  433.     TCPSendPBPtr = ^TCPSendPB;
  434.     TCPSendPB = RECORD
  435.         ulpTimeoutValue:        SInt8;
  436.         ulpTimeoutAction:        SInt8;
  437.         validityFlags:            SInt8;
  438.         pushFlag:                BOOLEAN;
  439.         urgentFlag:                BOOLEAN;
  440.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  441.         wdsPtr:                    Ptr;
  442.         sendFree:                LONGINT;
  443.         sendLength:                INTEGER;
  444.         userDataPtr:            Ptr;
  445.     END;
  446.  
  447.  
  448. { for receive and return rcv buff calls }
  449. {   Note: the filler in the following structure is in a different location than }
  450. {         that specified in the Programmer's Guide.  }
  451.     TCPReceivePBPtr = ^TCPReceivePB;
  452.     TCPReceivePB = RECORD
  453.         commandTimeoutValue:    SInt8;
  454.         markFlag:                BOOLEAN;
  455.         urgentFlag:                BOOLEAN;
  456.         filler:                    SInt8;                                    {  Filler for proper byte alignment   }
  457.         rcvBuff:                Ptr;
  458.         rcvBuffLen:                INTEGER;
  459.         rdsPtr:                    Ptr;
  460.         rdsLength:                INTEGER;
  461.         secondTimeStamp:        INTEGER;
  462.         userDataPtr:            Ptr;
  463.     END;
  464.  
  465.  
  466.     TCPClosePBPtr = ^TCPClosePB;
  467.     TCPClosePB = RECORD
  468.         ulpTimeoutValue:        SInt8;
  469.         ulpTimeoutAction:        SInt8;
  470.         validityFlags:            SInt8;
  471.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  472.         userDataPtr:            Ptr;
  473.     END;
  474.  
  475.     HistoBucketPtr = ^HistoBucket;
  476.     HistoBucket = RECORD
  477.         value:                    INTEGER;
  478.         counter:                LONGINT;
  479.     END;
  480.  
  481.  
  482. CONST
  483.     NumOfHistoBuckets            = 7;
  484.  
  485.  
  486. TYPE
  487.     TCPConnectionStatsPtr = ^TCPConnectionStats;
  488.     TCPConnectionStats = RECORD
  489.         dataPktsRcvd:            LONGINT;
  490.         dataPktsSent:            LONGINT;
  491.         dataPktsResent:            LONGINT;
  492.         bytesRcvd:                LONGINT;
  493.         bytesRcvdDup:            LONGINT;
  494.         bytesRcvdPastWindow:    LONGINT;
  495.         bytesSent:                LONGINT;
  496.         bytesResent:            LONGINT;
  497.         numHistoBuckets:        INTEGER;
  498.         sentSizeHisto:            ARRAY [0..6] OF HistoBucket;
  499.         lastRTT:                INTEGER;
  500.         tmrSRTT:                INTEGER;
  501.         rttVariance:            INTEGER;
  502.         tmrRTO:                    INTEGER;
  503.         sendTries:                SInt8;
  504.         sourchQuenchRcvd:        SInt8;
  505.     END;
  506.  
  507.     TCPStatusPBPtr = ^TCPStatusPB;
  508.     TCPStatusPB = RECORD
  509.         ulpTimeoutValue:        SInt8;
  510.         ulpTimeoutAction:        SInt8;
  511.         unused:                    LONGINT;
  512.         remoteHost:                ip_addr;
  513.         remotePort:                tcp_port;
  514.         localHost:                ip_addr;
  515.         localPort:                tcp_port;
  516.         tosFlags:                SInt8;
  517.         precedence:                SInt8;
  518.         connectionState:        SInt8;
  519.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  520.         sendWindow:                INTEGER;
  521.         rcvWindow:                INTEGER;
  522.         amtUnackedData:            INTEGER;
  523.         amtUnreadData:            INTEGER;
  524.         securityLevelPtr:        Ptr;
  525.         sendUnacked:            LONGINT;
  526.         sendNext:                LONGINT;
  527.         congestionWindow:        LONGINT;
  528.         rcvNext:                LONGINT;
  529.         srtt:                    LONGINT;
  530.         lastRTT:                LONGINT;
  531.         sendMaxSegSize:            LONGINT;
  532.         connStatPtr:            TCPConnectionStatsPtr;
  533.         userDataPtr:            Ptr;
  534.     END;
  535.  
  536.     TCPAbortPBPtr = ^TCPAbortPB;
  537.     TCPAbortPB = RECORD
  538.         userDataPtr:            Ptr;
  539.     END;
  540.  
  541.     TCPParamPtr = ^TCPParam;
  542.     TCPParam = RECORD
  543.         tcpRtoA:                LONGINT;
  544.         tcpRtoMin:                LONGINT;
  545.         tcpRtoMax:                LONGINT;
  546.         tcpMaxSegSize:            LONGINT;
  547.         tcpMaxConn:                LONGINT;
  548.         tcpMaxWindow:            LONGINT;
  549.     END;
  550.  
  551.     TCPStatsPtr = ^TCPStats;
  552.     TCPStats = RECORD
  553.         tcpConnAttempts:        LONGINT;
  554.         tcpConnOpened:            LONGINT;
  555.         tcpConnAccepted:        LONGINT;
  556.         tcpConnClosed:            LONGINT;
  557.         tcpConnAborted:            LONGINT;
  558.         tcpOctetsIn:            LONGINT;
  559.         tcpOctetsOut:            LONGINT;
  560.         tcpOctetsInDup:            LONGINT;
  561.         tcpOctetsRetrans:        LONGINT;
  562.         tcpInputPkts:            LONGINT;
  563.         tcpOutputPkts:            LONGINT;
  564.         tcpDupPkts:                LONGINT;
  565.         tcpRetransPkts:            LONGINT;
  566.     END;
  567.  
  568.     StreamPPtr                            = ^StreamPtr;
  569.     TCPGlobalInfoPBPtr = ^TCPGlobalInfoPB;
  570.     TCPGlobalInfoPB = RECORD
  571.         tcpParamPtr:            TCPParamPtr;
  572.         tcpStatsPtr:            TCPStatsPtr;
  573.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  574.         userDataPtr:            Ptr;
  575.         maxTCPConnections:        INTEGER;
  576.     END;
  577.  
  578.     TCPiopbPtr = ^TCPiopb;
  579.     TCPIOCompletionProcPtr = ProcPtr;  { PROCEDURE TCPIOCompletion(VAR iopb: TCPiopb); C; }
  580.  
  581.     TCPIOCompletionUPP = UniversalProcPtr;
  582.     TCPiopb = RECORD
  583.         fill12:                    ARRAY [0..11] OF SInt8;
  584.         ioCompletion:            TCPIOCompletionUPP;
  585.         ioResult:                INTEGER;
  586.         ioNamePtr:                Ptr;
  587.         ioVRefNum:                INTEGER;
  588.         ioCRefNum:                INTEGER;
  589.         csCode:                    INTEGER;
  590.         tcpStream:                StreamPtr;
  591.         CASE INTEGER OF
  592.         0: (
  593.             create:                TCPCreatePB;
  594.             );
  595.         1: (
  596.             open:                TCPOpenPB;
  597.             );
  598.         2: (
  599.             send:                TCPSendPB;
  600.             );
  601.         3: (
  602.             receive:            TCPReceivePB;
  603.             );
  604.         4: (
  605.             close:                TCPClosePB;
  606.             );
  607.         5: (
  608.             abort:                TCPAbortPB;
  609.             );
  610.         6: (
  611.             status:                TCPStatusPB;
  612.             );
  613.         7: (
  614.             globalInfo:            TCPGlobalInfoPB;
  615.             );
  616.     END;
  617.  
  618.  
  619. CONST
  620.     UDPCreate                    = 20;
  621.     UDPRead                        = 21;
  622.     UDPBfrReturn                = 22;
  623.     UDPWrite                    = 23;
  624.     UDPRelease                    = 24;
  625.     UDPMaxMTUSize                = 25;
  626.     UDPStatus                    = 26;
  627.     UDPMultiCreate                = 27;
  628.     UDPMultiSend                = 28;
  629.     UDPMultiRead                = 29;
  630.     UDPCtlMax                    = 29;
  631.  
  632.     UDPDataArrival                = 1;
  633.     UDPICMPReceived                = 2;
  634.     lastUDPEvent                = 32767;
  635.  
  636.  
  637. TYPE
  638.     UDPEventCode                        = INTEGER;
  639.     UDPNotifyProcPtr = ProcPtr;  { PROCEDURE UDPNotify(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport); }
  640.  
  641.     UDPNotifyUPP = UniversalProcPtr;
  642.     udp_port                            = INTEGER;
  643. { for create and release calls }
  644.     UDPCreatePBPtr = ^UDPCreatePB;
  645.     UDPCreatePB = RECORD
  646.         rcvBuff:                Ptr;
  647.         rcvBuffLen:                LONGINT;
  648.         notifyProc:                UDPNotifyUPP;
  649.         localPort:                INTEGER;
  650.         userDataPtr:            Ptr;
  651.         endingPort:                udp_port;
  652.     END;
  653.  
  654.     UDPSendPBPtr = ^UDPSendPB;
  655.     UDPSendPB = RECORD
  656.         reserved:                INTEGER;
  657.         remoteHost:                ip_addr;
  658.         remotePort:                udp_port;
  659.         wdsPtr:                    Ptr;
  660.         checkSum:                BOOLEAN;
  661.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  662.         sendLength:                INTEGER;
  663.         userDataPtr:            Ptr;
  664.         localPort:                udp_port;
  665.     END;
  666.  
  667. { for receive and buffer return calls }
  668.     UDPReceivePBPtr = ^UDPReceivePB;
  669.     UDPReceivePB = RECORD
  670.         timeOut:                INTEGER;
  671.         remoteHost:                ip_addr;
  672.         remotePort:                udp_port;
  673.         rcvBuff:                Ptr;
  674.         rcvBuffLen:                INTEGER;
  675.         secondTimeStamp:        INTEGER;
  676.         userDataPtr:            Ptr;
  677.         destHost:                ip_addr;                                {  only for use with multi rcv  }
  678.         destPort:                udp_port;                                {  only for use with multi rcv  }
  679.     END;
  680.  
  681.     UDPMTUPBPtr = ^UDPMTUPB;
  682.     UDPMTUPB = RECORD
  683.         mtuSize:                INTEGER;
  684.         remoteHost:                ip_addr;
  685.         userDataPtr:            Ptr;
  686.     END;
  687.  
  688.     UDPiopbPtr = ^UDPiopb;
  689.     UDPIOCompletionProcPtr = ProcPtr;  { PROCEDURE UDPIOCompletion(VAR iopb: UDPiopb); C; }
  690.  
  691.     UDPIOCompletionUPP = UniversalProcPtr;
  692.     UDPiopb = RECORD
  693.         fill12:                    ARRAY [0..11] OF SInt8;
  694.         ioCompletion:            UDPIOCompletionUPP;
  695.         ioResult:                INTEGER;
  696.         ioNamePtr:                Ptr;
  697.         ioVRefNum:                INTEGER;
  698.         ioCRefNum:                INTEGER;
  699.         csCode:                    INTEGER;
  700.         udpStream:                StreamPtr;
  701.         CASE INTEGER OF
  702.         0: (
  703.             create:                UDPCreatePB;
  704.             );
  705.         1: (
  706.             send:                UDPSendPB;
  707.             );
  708.         2: (
  709.             receive:            UDPReceivePB;
  710.             );
  711.         3: (
  712.             mtu:                UDPMTUPB;
  713.             );
  714.     END;
  715.  
  716.  
  717. CONST
  718.     uppGetIPIOCompletionProcInfo = $000000C1;
  719.     uppIPIOCompletionProcInfo = $000000C1;
  720.     uppICMPEchoNotifyProcInfo = $000000C1;
  721.     uppTCPNotifyProcInfo = $0000EEC0;
  722.     uppTCPIOCompletionProcInfo = $000000C1;
  723.     uppUDPNotifyProcInfo = $00003EC0;
  724.     uppUDPIOCompletionProcInfo = $000000C1;
  725.  
  726. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  727.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  728.     INLINE $2E9F;
  729.     {$ENDC}
  730.  
  731. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  732.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  733.     INLINE $2E9F;
  734.     {$ENDC}
  735.  
  736. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  737.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  738.     INLINE $2E9F;
  739.     {$ENDC}
  740.  
  741. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  742.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  743.     INLINE $2E9F;
  744.     {$ENDC}
  745.  
  746. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  747.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  748.     INLINE $2E9F;
  749.     {$ENDC}
  750.  
  751. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  752.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  753.     INLINE $2E9F;
  754.     {$ENDC}
  755.  
  756. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  757.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  758.     INLINE $2E9F;
  759.     {$ENDC}
  760.  
  761. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  762.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  763.     {To be implemented:  Glue to move parameters into registers.}
  764.     {$ENDC}
  765.  
  766. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  767.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  768.     {To be implemented:  Glue to move parameters into registers.}
  769.     {$ENDC}
  770.  
  771. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  772.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  773.     {To be implemented:  Glue to move parameters into registers.}
  774.     {$ENDC}
  775.  
  776. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  777.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  778.     INLINE $205F, $4E90;
  779.     {$ENDC}
  780.  
  781. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  782.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  783.     {To be implemented:  Glue to move parameters into registers.}
  784.     {$ENDC}
  785.  
  786. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  787.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  788.     INLINE $205F, $4E90;
  789.     {$ENDC}
  790.  
  791. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  792.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  793.     {To be implemented:  Glue to move parameters into registers.}
  794.     {$ENDC}
  795.  
  796. {$ALIGN RESET}
  797. {$POP}
  798.  
  799. {$SETC UsingIncludes := MacTCPIncludes}
  800.  
  801. {$ENDC} {__MACTCP__}
  802.  
  803. {$IFC NOT UsingIncludes}
  804.  END.
  805. {$ENDC}
  806.